home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5338 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  843 b 

  1. Path: castle.nando.net!news
  2. From: actuary@nando.net   (Bill McCarthy)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Leap Years
  5. Date: 11 Feb 1996 17:10:51 GMT
  6. Organization: News & Observer Public Access
  7. Message-ID: <4fl7ur$nsb@castle.nando.net>
  8. References: <8BA8405.02C70020E1.uuout@sourcebbs.com>
  9. Reply-To: actuary@nando.net (Bill McCarthy)
  10. NNTP-Posting-Host: grail519.nando.net
  11. X-Newsreader: IBM NewsReader/2 v1.2
  12.  
  13. In <8BA8405.02C70020E1.uuout@sourcebbs.com>,
  14. david.mohorn@sourcebbs.com (DAVID MOHORN) writes:
  15.  
  16. >How do you feature out leap years?
  17.  
  18. Huh?
  19.  
  20. >If its evenly divisible by 400 and 4?
  21.  
  22. Obviously not.  1996 is a leap year and is certainly not "evenly divisible"
  23. by 400.
  24.  
  25. Here's a macro to make that determination:
  26.  
  27. #define LeapYear( yr )  (!((int)(yr) & 3) && ((yr) % 100 || !((yr) % 400))) 
  28.  
  29. Bill McCarthy
  30. actuary@nando.net
  31. Wendell, NC  USA
  32.  
  33.